<?php

namespace App\Http\Middleware;

use Closure;
use App\Traits\Auth;
use App\Traits\BaseFun;

class CheckLogin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */

    public function handle($request, Closure $next)
    {
        if(Auth::isLogin($request)){
            return $next($request);
        }else{
            $dataArr=['state'=>2,'data'=>0,'msg'=>'没有登录'];
            return BaseFun::jsonReturn($dataArr);
        }
        
    }
}
